<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>个人信息</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
<link rel="stylesheet" href="{{ url('/common/mobile-common/common.css') }}">	
<link rel="stylesheet" href="{{ url('mobile/css/member/info.css') }}">	
<script src="{{ url('mobile/js/jquery-1.8.3.min.js') }}"></script>
<script src="{{ url('/common/mobile-common/hmt.js') }}"></script>
</head>
<body>
	<div class="abouts">
		<div class="wrap-cont clearfix">
				<div class="wrap-cont per-info">
					<div class="section section2 info-show">
						<p>
							<span>姓名</span>
							<em>{{$one->nickname}}</em>
						</p>
						<p>
							<span>性别</span>
							<em>{{App\Http\Util\Sex::getLabel($one->sex)}}</em>
						</p>
						<p>
							<span>生日</span>
							<em>{{App\Http\Util\TimeHelper::formatDate($one->birthday)}}</em>
						</p>
						<p>
							<span>绑定手机号</span>
							<em>{{$one->phone}}</em>
						</p>
						<p>
							<a href="{{url('wap/member/changeTel')}}" class="ghtel" target="_blank">
								<span>更换手机号</span>
								<em><img src="{{ url('mobile/images/more-icon.png')}}" class="more-icon"></em>
							</a>
						</p>
						
					</div>	
					<div class="opt-btn">
						<a class="edit-btn">编辑资料</a>
					</div>	
				</div>
				<!--end-->
				<!--编辑个人信息-->
				<form method="post" action="{{url('wap/member/info')}}">
				<div class="wrap-cont per-info-edit">
					<div class="section section2 info-edit">
						<p>
							<span>姓名</span>
							<input type="text" name="nickname" value="{{$one->nickname}}">
						</p>
						<p>

							<span class="span-xb">性别</span>
							
							<input type="radio" name="sex" value="1" @if($one->sex==1)checked @endif>
							<i class="nv-inp">男</i>

							<input type="radio" name="sex" value="2" @if($one->sex==2)checked @endif>
							<i>女</i>
						</p>
						<p>
							<span>生日</span>
							<input type="date" name="birthday" value="{{App\Http\Util\TimeHelper::formatDate($one->birthday)}}">
						</p>
						<!--<p>
							<span>手机号</span>
							<input type="text" name="phone" id="phone" value="">
						</p>-->
					</div>
					<div class="opt-btn">
						<button class="save-btn">保存</button>
					</div>	
				</div>
				</form>
				<!--end-->
				
		</div>
	</div>
</body>
<script>
	$(function(){
		//编辑资料
		$(".edit-btn").click(function(){
			$(".info-show").hide();
			$(".per-info-edit").show();
		});
	//保存资料
	$(".save-btn").on("touchstart",function(){
		saveInfo();
	});
	//更换头像
	$(".changImg em").on("touchstart",function(){
		$(".in-sc").click();
	})
	function saveInfo(){
		var nameTxt=$(".per-info-edit .info-show input[name=nickname]").val();
		var sexTxt=$(".per-info-edit .info-show input:checked").val();
		var birthTxt=$(".per-info-edit .info-show input[name=birth]").val();
		var telTxt=$("#phone").val();
		var myreg = /^1[34578]\d{9}$/;
		if(nameTxt.length==0){
			alert("姓名不能为空！");
			$(".per-info-edit .info-show input[name=nickname]").focus();
		}
//		else if(sexTxt!=1 || sexTxt!=2){
//			alert("性别不能为空！");
//			$(".per-info-edit .info-show input[name=sex]").focus();
//		}
//		else if(birthTxt.length==0){
//			alert("生日不能为空！");
//			$(".per-info-edit .info-show input[name=birth]").focus();
//		}
		else if(telTxt.length==0){
			alert("手机号码不能为空！");
			$(".per-info-edit .info-show input[name=phone]").focus();
		}
		else if(!telTxt.match(myreg)){
			alert("请输入正确的手机号码！");
			$(".per-info-edit .info-show input[name=phone]").focus();
			$(".per-info-edit .info-show input[name=phone]").val('');
		}
		else{
			alert("信息修改成功");
			$(".info-show").show();
			$(".per-info-edit").hide();
		}
	}
	})
</script>
</html>
